﻿using DPS.Prototype.PolicyBase;
using DPS.Prototype.Model;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using DPS.Prototype.Policy;

namespace DPSTesting
{
    internal class TestHelper
    {
        public static ProdLine ConstructProdLine()
        {
            List<string> skus = new List<string>();
            skus.Add("sku1");
            skus.Add("sku2");
            skus.Add("sku3");
            skus.Add("sku4");

            //skus.Add(new Sku("sku1"));
            //skus.Add(new Sku("sku2"));
            //skus.Add(new Sku("sku3"));
            //skus.Add(new Sku("sku4"));

            ProdLine prodLine = new ProdLine("AHEG", "Line001", "A2", skus);
            List<Capacity> cs = new System.Collections.Generic.List<Capacity>();
            Capacity c1 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 0, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 0, 0, 0), EndTime = new DateTime(2011, 4, 19, 2, 0, 0) };
            Capacity c2 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 1, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 2, 0, 0), EndTime = new DateTime(2011, 4, 19, 4, 0, 0) };
            Capacity c3 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 2, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 4, 0, 0), EndTime = new DateTime(2011, 4, 19, 8, 0, 0) };
            Capacity c4 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 3, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 8, 0, 0), EndTime = new DateTime(2011, 4, 19, 10, 0, 0) };
            Capacity c5 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 4, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 10, 0, 0), EndTime = new DateTime(2011, 4, 19, 11, 30, 0) };

            Capacity c6 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 5, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 13, 30, 0), EndTime = new DateTime(2011, 4, 19, 15, 30, 0) };
            Capacity c7 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 6, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 15, 30, 0), EndTime = new DateTime(2011, 4, 19, 17, 30, 0) };

            Capacity c8 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 7, UPH = 200.00f, Shift = Shift.Day, StartTime = new DateTime(2011, 4, 19, 18, 30, 0), EndTime = new DateTime(2011, 4, 19, 20, 30, 0) };
            Capacity c9 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 8, UPH = 200.00f, Shift = Shift.Night, StartTime = new DateTime(2011, 4, 19, 20, 30, 0), EndTime = new DateTime(2011, 4, 19, 22, 30, 0) };
            Capacity c10 = new Capacity() { ProdLine = prodLine, CapacityStatus = CapacityStatus.TotalAviralble, SortNo = 9, UPH = 200.00f, Shift = Shift.Night, StartTime = new DateTime(2011, 4, 19, 22, 30, 0), EndTime = new DateTime(2011, 4, 19, 23, 30, 0) };

            c1.Previous = null;
            c1.Next = c2;

            c2.Previous = c1;
            c2.Next = c3;

            c3.Previous = c2;
            c3.Next = c4;

            c4.Previous = c3;
            c4.Next = c5;

            c5.Previous = c4;
            c5.Next = c6;

            c6.Previous = c5;
            c6.Next = c7;

            c7.Previous = c6;
            c7.Next = c8;

            c8.Previous = c7;
            c8.Next = c9;

            c9.Previous = c8;
            c9.Next = c10;

            c10.Previous = c9;
            c10.Next = null;

            cs.Add(c1);
            cs.Add(c2);
            cs.Add(c3);
            cs.Add(c4);
            cs.Add(c5);
            cs.Add(c6);
            cs.Add(c8);
            cs.Add(c9);
            cs.Add(c10);
            
            prodLine.Capacitys = cs;

            return prodLine;
        }

        public static PrivateObject GetProdCompetitorPrivateObject()
        {
            ProdLine prodLine = TestHelper.ConstructProdLine();
            object obj = new DefaultProdCompetitor(prodLine) as ProdCompetitorBase;
            PrivateObject param0 = new PrivateObject(obj, new PrivateType(typeof(ProdCompetitorBase)));
            return param0;
        }
    }
}
